# Build recipe for cmake.
#
# Copyright (c) 2018 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

program=cmake
version=3.13.2
release=1

# Set 'outdir' for a nice and well-organized output directory
outdir="${outdir}/${arch}/devel"

tarname=${program}-${version}.tar.gz

# Remote source(s)
fetch=http://cmake.org/files/v3.12/$tarname

description="
Cross-platform make system.

CMake is a family of tools designed to build, test and package
software.  CMake is used to control the software compilation process
using simple platform and compiler independent configuration files.
"

homepage=http://www.cmake.org
license=Custom

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    # Set sane permissions
    chmod -R u+w,go-w,a+rX-s .

    CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
    ./bootstrap \
     --prefix=/usr \
     --docdir=/share/doc/${program}-${version} \
     --system-libs \
     --no-system-jsoncpp \
     --no-system-librhash \
     --parallel=$jobs

    make -j${jobs} V=1
    make -j${jobs} DESTDIR="$destdir" install
}

